/*
package com.hfzy.ihk.facade.freeswitchCall.vo;



import java.util.Date;
import java.util.HashMap;
import java.util.Map;

*/
/**
 * Created by Administrator on 2016/4/26.
 * 呼叫任务：发起呼叫时产生
 *
 *
 * 云呼版本  1.0  ，置业默认：mainCallPhone:客户号码。targetCallPhone：经纪号码
 * 云呼版本  2.0  ，置业默认：mainCallPhone:经纪号码。targetCallPhone：客户号码
 *
 *//*

public class CallHistory extends BaseEntity{
    private static final long serialVersionUID = 1L;

    */
/**
     * E1,阿里云：客户号码
     * 手机云呼： 经纪号码
     * *//*

    private String mainCallPhone = Constants.NULL_STR; //主叫；由拨号时发送过来
    */
/**
     *
     * *//*

    private String targetCallPhone = Constants.NULL_STR; //被叫；由拨号时发送过来
    private String showNum = Constants.NULL_STR; //主显号码：小号、E1固话等；
    private Long dataId = -1L; //置业或app数据库 数据id，用于jms推送数据时，置业或app更新数据的索引；这要求置业或app保存数据成功后再提交呼叫任务到云呼
    private Integer whereFrom = -1; //来源：app(0),置业(1)，洗号(2)，洗主显(3)，job(99999,主要用于批量插入，定时检测是否达到时间阀值),crm(5)
    private Integer pageFrom = -1; //app盘源(0),app联动call(1),置业盘源(2)，置业联动call(3),电子客簿（4），测试座机页面（5）,app 拨号记录(6)
    private String machineFrom = Constants.NULL_STR;//机器码：用于定位websocket对象（websocket）；app的话，传userId
    private Integer mainCallType = -1; //mainCallPhone是什么号码？经纪人：1， 客户：0
    private String customerName = Constants.NULL_STR; //客户名字

    private String propertyNo  = Constants.NULL_STR;    //房源编号或客户编号（使用来源页面pageFrom区分）
    private String project  = Constants.NULL_STR;       //项目名或客户最新根据（使用来源页面pageFrom区分）
    private String objectId  = Constants.NULL_STR;       ////置业oracle通话记录中，盘源、客户、项目的id（联动call）

    private String enrollNumber = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String unitId = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String managerId = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String teamId = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String groupManagerId = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String topManagerId = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String managerIds = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String zyRemark = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）
    private String totalAddress = Constants.NULL_STR; //该字段不存mysql，只临时存储redis。结束通话时推送给大数据（phoenix/elasticsearch）

    private Integer commitTo = -1; //提交到哪里：东进(0)/电信(1)，手机（2）(在线),手机离线(3),阿里云（9）
    private Boolean commitOk = false; //提交呼叫任务到CTI/福建电信 成功
    private Date commitTime; //提交呼叫任务到 CTI/福建电信时间

    private Integer city = -1;  //经纪所在城市:广州(1)/东莞(2)/佛山(3)

    private String sessionId = Constants.NULL_STR; //会话ID
    private Integer callType = -1; //通话类型：呼出(0)、呼入(1),呼出《经纪人呼主显转接到客户》(2)

    private String ims = Constants.NULL_STR; //计费号码，记录使用哪个计费号码呼出

    private String recordFileUrl = Constants.NULL_STR; //录音文件地址
    //通话时长（S）（主叫被叫都接通后的通话时长） （被叫的通话时长）
    private Long recordTimeLength = -1L;
    private Integer points = 0; //消费点数（n个6秒）
    private float money = 0; //通话费用+录音费用
    private String recordFileUrlPartA = Constants.NULL_STR; //语音分析录音文件地址

    private String voiceType;         //语音分析结果    参照VoiceResultEnum
    private String voiceCategory;     //语音分析结果分类 参照VoiceResultEnum
    private String voiceContent;      //语音分析内容

    private Integer voiceStatus = 0;  //语音-2(旧数据) / -1(识别异常) / 0(未识别) / 1(实时已识别) / 2(JOB已识别) /3(无需识别，即已接听)
    private Integer voiceEngine;      //语音引擎 1(讯飞) / 2(百度)
    private Date voiceStartTime;      //语音分析请求时间
    private Date voiceEndTime;        //语音分析返回结果时间

    private Integer interrupt=-1; //是否中断    未中断（-1），自动动中断（0），手段中断（1）
    private Date interruptTime; //中断时间

    //=================呼叫状态================
    private Boolean mainCallRinging; //主叫响铃
    private Date mainCallRingingTime; //主叫响铃时间
    private Date receiveMainCallRingingTime; //接收主叫响铃状态时间
    private Boolean mainCallAnswered; //主叫应答
    private Date mainCallAnsweredTime; //主叫应答
    private Date receiveMainCallAnsweredTime; //接收主叫应答状态时间
    private Boolean mainCallFailed; //呼叫主叫失败：如果没有响铃，表示主叫空号；如有响铃，表示未接听或把来电号码加入黑名单或手机飞行模式（电信）
    private Date mainCallFailedTime; //呼叫主叫失败时间
    private Date receiveMainCallFailedTime; //接收呼叫主叫失败状态时间
    private Boolean targetCallRinging; //被叫响铃
    private Date targetCallRingingTime; //被叫响铃时间
    private Date receiveTargetCallRingingTime; //接收被叫响铃状态时间
    private Boolean targetCallAnswered; //被叫应答
    private Date targetCallAnsweredTime; //被叫应答
    private Date receiveTargetCallAnsweredTime; //接收被叫应答状态时间
    private Boolean targetCallFailed; //呼叫被叫失败：如果没有响铃，表示被叫空号；如有响铃，表示未接听或把来电号码加入黑名单或手机飞行模式；（电信）
    private Date targetCallFailedTime; //呼叫被叫失败时间
    private Date receiveTargetCallFailedTime; //接收呼叫被叫失败状态时间
    private Date receiveAppStartTime;  //接收app开始呼叫时间
    private Date receiveAppStopTime;   //接收app呼叫结束时间（app_stop状态的接收时间）
    private Date receiveApprecordFileTime; //接收app录音文件时间

    private Date disconnectTime; //通话结束时间（也包含使用手机拨打的结束时间）
    private Date receiveDisconnectTime; //接收通话结束时间状态时间
    private String failedReason = Constants.NULL_STR; //不能正常通话原因

    private String messageId = Constants.NULL_STR; //jms msg Id
    private String jsonpCallBack = Constants.NULL_STR; //用于jsonP 的callBack名，不需记录到数据库
    private Boolean isInserted = false; //用于判断是否已经入库，不需要记录到数据库

    private String today = Constants.NULL_STR;

    private Integer oggChange;  //是否已经将war转成ogg 空或者0 -未转过ogg,1-已成功转了ogg，-1 --转了ogg但是没找到文件，2--成功删除了对应的wav文件，-2--执行了删除文件job但是未找wav文件

    private Integer dealStatus; //是否已经转到HBase标识 空或者0 --未转移，1-已经成功转移，-1转了但是没找到文件(可能为空，可能按规则找不到)，-3（掉了转移接口但是没成功存到hbase）， 2--成功删除了对应的wav文件，-2--执行了删除文件但是job没找到wav

    private String hbaseRecordFileUrl; //hbase录音文件链接

    private String hbaseRecordFileUrlA;//hbase录音文件链接头文件

    private String isTest;

    private Date mainCallStartTime;  //阿里录音话单，主叫开始时间

    private Date mainCallEndTime;   //阿里录音话单，主叫结束时间

    private Integer mainCallLength;   //阿里录音话单，主叫通话时长（s）

    private Date targetCallStartTime;  //阿里录音话单，被叫开始时间

    private Date targetCallEndTime;   //阿里录音话单，被叫结束时间

    private Integer targetCallLength;   //阿里录音话单，被叫通话时长（s）

    private Integer cleanNumberTaskId = -1; //用于洗号获取任务对象，不需要记录到数据库


    public Date getMainCallStartTime() {
        return mainCallStartTime;
    }

    public void setMainCallStartTime(Date mainCallStartTime) {
        this.mainCallStartTime = mainCallStartTime;
    }

    public Date getMainCallEndTime() {
        return mainCallEndTime;
    }

    public void setMainCallEndTime(Date mainCallEndTime) {
        this.mainCallEndTime = mainCallEndTime;
    }

    public Integer getMainCallLength() {
        return mainCallLength;
    }

    public void setMainCallLength(Integer mainCallLength) {
        this.mainCallLength = mainCallLength;
    }

    public Date getTargetCallStartTime() {
        return targetCallStartTime;
    }

    public void setTargetCallStartTime(Date targetCallStartTime) {
        this.targetCallStartTime = targetCallStartTime;
    }

    public Date getTargetCallEndTime() {
        return targetCallEndTime;
    }

    public void setTargetCallEndTime(Date targetCallEndTime) {
        this.targetCallEndTime = targetCallEndTime;
    }

    public Integer getTargetCallLength() {
        return targetCallLength;
    }

    public void setTargetCallLength(Integer targetCallLength) {
        this.targetCallLength = targetCallLength;
    }

    public String getIsTest() {
        return isTest;
    }

    public void setIsTest(String isTest) {
        this.isTest = isTest;
    }

    public String getObjectId() {
        return objectId;
    }

    public void setObjectId(String objectId) {
        this.objectId = objectId;
    }

    public String getHbaseRecordFileUrl() {
        return hbaseRecordFileUrl;
    }

    public void setHbaseRecordFileUrl(String hbaseRecordFileUrl) {
        this.hbaseRecordFileUrl = hbaseRecordFileUrl;
    }

    public String getHbaseRecordFileUrlA() {
        return hbaseRecordFileUrlA;
    }

    public void setHbaseRecordFileUrlA(String hbaseRecordFileUrlA) {
        this.hbaseRecordFileUrlA = hbaseRecordFileUrlA;
    }

    public Integer getOggChange() {
        return oggChange;
    }

    public void setOggChange(Integer oggChange) {
        this.oggChange = oggChange;
    }

    public Integer getDealStatus() {
        return dealStatus;
    }

    public void setDealStatus(Integer dealStatus) {
        this.dealStatus = dealStatus;
    }

    public String getToday() {
        return today;
    }

    public void setToday(String today) {
        this.today = today;
    }

    public float getMoney() {
        return money;
    }

    public void setMoney(float money) {
        this.money = money;
    }

    public String getIms() {
        return ims;
    }

    public void setIms(String ims) {
        this.ims = ims;
    }

    public void setMainCallPhone(String mainCallPhone) {
        this.mainCallPhone = mainCallPhone;
    }

    public void setTargetCallPhone(String targetCallPhone) {
        this.targetCallPhone = targetCallPhone;
    }

    public void setShowNum(String showNum) {
        this.showNum = showNum;
    }

    public void setDataId(Long dataId) {
        this.dataId = dataId;
    }

    public void setWhereFrom(Integer whereFrom) {
        this.whereFrom = whereFrom;
    }

    public void setPageFrom(Integer pageFrom) {
        this.pageFrom = pageFrom;
    }

    public void setMachineFrom(String machineFrom) {
        this.machineFrom = machineFrom;
    }

    public void setMainCallType(Integer mainCallType) {
        this.mainCallType = mainCallType;
    }

    public void setCommitTo(Integer commitTo) {
        this.commitTo = commitTo;
    }

    public void setCommitOk(Boolean commitOk) {
        this.commitOk = commitOk;
    }

    public void setCity(Integer city) {
        this.city = city;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public void setCallType(Integer callType) {
        this.callType = callType;
    }

    public void setRecordFileUrl(String recordFileUrl) {
        this.recordFileUrl = recordFileUrl;
    }

    public void setRecordTimeLength(Long recordTimeLength) {
        this.recordTimeLength = recordTimeLength;
    }

    public void setRecordFileUrlPartA(String recordFileUrlPartA) {
        this.recordFileUrlPartA = recordFileUrlPartA;
    }

    public void setVoiceType(String voiceType) {
        this.voiceType = voiceType;
    }

    public void setVoiceCategory(String voiceCategory) {
        this.voiceCategory = voiceCategory;
    }

    public void setVoiceContent(String voiceContent) {
        this.voiceContent = voiceContent;
    }

    public void setVoiceStatus(Integer voiceStatus) {
        this.voiceStatus = voiceStatus;
    }

    public void setVoiceEngine(Integer voiceEngine) {
        this.voiceEngine = voiceEngine;
    }

    public void setVoiceStartTime(Date voiceStartTime) {
        this.voiceStartTime = voiceStartTime;
    }

    public void setVoiceEndTime(Date voiceEndTime) {
        this.voiceEndTime = voiceEndTime;
    }

    public void setMainCallRinging(Boolean mainCallRinging) {
        this.mainCallRinging = mainCallRinging;
    }

    public void setMainCallRingingTime(Date mainCallRingingTime) {
        this.mainCallRingingTime = mainCallRingingTime;
    }

    public void setMainCallAnswered(Boolean mainCallAnswered) {
        this.mainCallAnswered = mainCallAnswered;
    }

    public void setMainCallAnsweredTime(Date mainCallAnsweredTime) {
        this.mainCallAnsweredTime = mainCallAnsweredTime;
    }

    public void setMainCallFailed(Boolean mainCallFailed) {
        this.mainCallFailed = mainCallFailed;
    }

    public void setMainCallFailedTime(Date mainCallFailedTime) {
        this.mainCallFailedTime = mainCallFailedTime;
    }

    public void setTargetCallRinging(Boolean targetCallRinging) {
        this.targetCallRinging = targetCallRinging;
    }

    public Integer getCleanNumberTaskId() {
        return cleanNumberTaskId;
    }

    public void setCleanNumberTaskId(Integer cleanNumberTaskId) {
        this.cleanNumberTaskId = cleanNumberTaskId;
    }

    public void setTargetCallRingingTime(Date targetCallRingingTime) {
        this.targetCallRingingTime = targetCallRingingTime;
    }

    public void setTargetCallAnswered(Boolean targetCallAnswered) {
        this.targetCallAnswered = targetCallAnswered;
    }

    public void setTargetCallAnsweredTime(Date targetCallAnsweredTime) {
        this.targetCallAnsweredTime = targetCallAnsweredTime;
    }

    public String getPropertyNo() {
        return propertyNo;
    }

    public void setPropertyNo(String propertyNo) {
        this.propertyNo = propertyNo;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public void setTargetCallFailed(Boolean targetCallFailed) {
        this.targetCallFailed = targetCallFailed;
    }

    public void setTargetCallFailedTime(Date targetCallFailedTime) {
        this.targetCallFailedTime = targetCallFailedTime;
    }

    public void setDisconnectTime(Date disconnectTime) {
        this.disconnectTime = disconnectTime;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public String getMainCallPhone() {
        return mainCallPhone;
    }

    public String getTargetCallPhone() {
        return targetCallPhone;
    }

    public String getShowNum() {
        return showNum;
    }

    public Long getDataId() {
        return dataId;
    }

    public Integer getWhereFrom() {
        return whereFrom;
    }

    public Integer getPageFrom() {
        return pageFrom;
    }

    public String getMachineFrom() {
        return machineFrom;
    }

    public Integer getMainCallType() {
        return mainCallType;
    }

    public Integer getCommitTo() {
        return commitTo;
    }

    public Boolean getCommitOk() {
        return commitOk;
    }

    public Integer getCity() {
        return city;
    }

    public String getSessionId() {
        return sessionId;
    }

    public Integer getCallType() {
        return callType;
    }

    public String getRecordFileUrl() {
        return recordFileUrl;
    }

    public Long getRecordTimeLength() {
        return recordTimeLength;
    }

    public String getRecordFileUrlPartA() {
        return recordFileUrlPartA;
    }

    public String getVoiceType() {
        return voiceType;
    }

    public String getVoiceCategory() {
        return voiceCategory;
    }

    public String getVoiceContent() {
        return voiceContent;
    }

    public Integer getVoiceStatus() {
        return voiceStatus;
    }

    public Integer getVoiceEngine() {
        return voiceEngine;
    }

    public Date getVoiceStartTime() {
        return voiceStartTime;
    }

    public Date getVoiceEndTime() {
        return voiceEndTime;
    }

    public Boolean getMainCallRinging() {
        return mainCallRinging;
    }

    public Date getMainCallRingingTime() {
        return mainCallRingingTime;
    }

    public Boolean getMainCallAnswered() {
        return mainCallAnswered;
    }

    public Date getMainCallAnsweredTime() {
        return mainCallAnsweredTime;
    }

    public Boolean getMainCallFailed() {
        return mainCallFailed;
    }

    public Date getMainCallFailedTime() {
        return mainCallFailedTime;
    }

    public Boolean getTargetCallRinging() {
        return targetCallRinging;
    }

    public Date getTargetCallRingingTime() {
        return targetCallRingingTime;
    }

    public Boolean getTargetCallAnswered() {
        return targetCallAnswered;
    }

    public Date getTargetCallAnsweredTime() {
        return targetCallAnsweredTime;
    }

    public Boolean getTargetCallFailed() {
        return targetCallFailed;
    }

    public Date getTargetCallFailedTime() {
        return targetCallFailedTime;
    }

    public Date getDisconnectTime() {
        return disconnectTime;
    }

    public String getMessageId() {
        return messageId;
    }

    public String getJsonpCallBack() {
        return jsonpCallBack;
    }

    public String getFailedReason() {
        return failedReason;
    }

    public void setFailedReason(String failedReason) {
        this.failedReason = failedReason;
    }

    public void setJsonpCallBack(String jsonpCallBack) {
        this.jsonpCallBack = jsonpCallBack;
    }

    public Integer getPoints() {
        return points;
    }

    public void setPoints(Integer points) {
        this.points = points;
    }

    public Date getCommitTime() {
        return commitTime;
    }

    public void setCommitTime(Date commitTime) {
        this.commitTime = commitTime;
    }

    public Date getReceiveMainCallRingingTime() {
        return receiveMainCallRingingTime;
    }



    public void setReceiveMainCallRingingTime(Date receiveMainCallRingingTime) {
        this.receiveMainCallRingingTime = receiveMainCallRingingTime;
    }

    public Date getReceiveMainCallAnsweredTime() {
        return receiveMainCallAnsweredTime;
    }

    public void setReceiveMainCallAnsweredTime(Date receiveMainCallAnsweredTime) {
        this.receiveMainCallAnsweredTime = receiveMainCallAnsweredTime;
    }

    public Date getReceiveMainCallFailedTime() {
        return receiveMainCallFailedTime;
    }

    public void setReceiveMainCallFailedTime(Date receiveMainCallFailedTime) {
        this.receiveMainCallFailedTime = receiveMainCallFailedTime;
    }

    public Date getReceiveTargetCallRingingTime() {
        return receiveTargetCallRingingTime;
    }

    public void setReceiveTargetCallRingingTime(Date receiveTargetCallRingingTime) {
        this.receiveTargetCallRingingTime = receiveTargetCallRingingTime;
    }

    public Date getReceiveTargetCallAnsweredTime() {
        return receiveTargetCallAnsweredTime;
    }

    public void setReceiveTargetCallAnsweredTime(Date receiveTargetCallAnsweredTime) {
        this.receiveTargetCallAnsweredTime = receiveTargetCallAnsweredTime;
    }

    public Date getReceiveTargetCallFailedTime() {
        return receiveTargetCallFailedTime;
    }

    public void setReceiveTargetCallFailedTime(Date receiveTargetCallFailedTime) {
        this.receiveTargetCallFailedTime = receiveTargetCallFailedTime;
    }

    public Date getReceiveDisconnectTime() {
        return receiveDisconnectTime;
    }

    public void setReceiveDisconnectTime(Date receiveDisconnectTime) {
        this.receiveDisconnectTime = receiveDisconnectTime;
    }

    public Integer getInterrupt() {
        return interrupt;
    }

    public void setInterrupt(Integer interrupt) {
        this.interrupt = interrupt;
    }

    public Date getInterruptTime() {
        return interruptTime;
    }

    public void setInterruptTime(Date interruptTime) {
        this.interruptTime = interruptTime;
    }

    public Boolean getIsInserted() {
        return isInserted;
    }

    public void setIsInserted(Boolean isInserted) {
        this.isInserted = isInserted;
    }

    public Date getReceiveAppStartTime() {
        return receiveAppStartTime;
    }

    public void setReceiveAppStartTime(Date receiveAppStartTime) {
        this.receiveAppStartTime = receiveAppStartTime;
    }

    public Date getReceiveAppStopTime() {
        return receiveAppStopTime;
    }

    public void setReceiveAppStopTime(Date receiveAppStopTime) {
        this.receiveAppStopTime = receiveAppStopTime;
    }

    public Date getReceiveApprecordFileTime() {
        return receiveApprecordFileTime;
    }

    public void setReceiveApprecordFileTime(Date receiveApprecordFileTime) {
        this.receiveApprecordFileTime = receiveApprecordFileTime;
    }

    public String getProject() {
        return project;
    }

    public void setProject(String project) {
        this.project = project;
    }

    public String getTotalAddress() {
        return totalAddress;
    }

    public void setTotalAddress(String totalAddress) {
        this.totalAddress = totalAddress;
    }

    public String getEnrollNumber() {
        return enrollNumber;
    }

    public void setEnrollNumber(String enrollNumber) {
        this.enrollNumber = enrollNumber;
    }

    public String getUnitId() {
        return unitId;
    }

    public void setUnitId(String unitId) {
        this.unitId = unitId;
    }

    public String getManagerId() {
        return managerId;
    }

    public void setManagerId(String managerId) {
        this.managerId = managerId;
    }

    public String getTeamId() {
        return teamId;
    }

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    public String getGroupManagerId() {
        return groupManagerId;
    }

    public void setGroupManagerId(String groupManagerId) {
        this.groupManagerId = groupManagerId;
    }

    public String getTopManagerId() {
        return topManagerId;
    }

    public void setTopManagerId(String topManagerId) {
        this.topManagerId = topManagerId;
    }

    public String getManagerIds() {
        return managerIds;
    }

    public void setManagerIds(String managerIds) {
        this.managerIds = managerIds;
    }

    public String getZyRemark() {
        return zyRemark;
    }

    public void setZyRemark(String zyRemark) {
        this.zyRemark = zyRemark;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("id:");
        sb.append(this.getId());
        sb.append("sessionId:");
        sb.append(this.getSessionId());
        sb.append("version:");
        sb.append(this.getVersion());
        sb.append("mainCallPhone:");
        sb.append(this.getMainCallPhone());
        sb.append("targetCallPhone:");
        sb.append(this.getTargetCallPhone());
        return sb.toString();
    }

    public static Map<String,String> getCallHistoryMapFormRedis(String sessionId){

        Map<String,String> callHistoryMap = RedisUtils.getAllHash(RedisKey.CALL_HISTORY_RPIX+sessionId);

        if (callHistoryMap.isEmpty() || callHistoryMap == null)
            return null;

        return callHistoryMap;
    }

    public static CallHistory fromRedisHashMap(String sessionId){

        Map<String,String> callHistoryMap = null ;

        callHistoryMap = getCallHistoryMapFormRedis(sessionId);

        if (callHistoryMap.isEmpty() || callHistoryMap == null)
            return null;

        return fromMap(callHistoryMap);
    }

    */
/**数据库加字段必须加这里，否则字段是存不到mysql里面的*//*

    public static CallHistory fromMap(Map<String,String> callHistoryMap){
        CallHistory callHistory = new CallHistory();

        try {

            for(String field :callHistoryMap.keySet()){

                String value = callHistoryMap.get(field);

                switch (field){
                    case RedisFields.CREATE_USER_ID:
                        callHistory.setCreateUserId(Integer.valueOf(value));
                        break;
                    case RedisFields.CREATE_TIME:
                        callHistory.setCreateTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        callHistory.setToday(Utils.date2DateString(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS)));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_PHONE :// "mainCallPhone"; //主叫；由拨号时发送过来
                        callHistory.setMainCallPhone(value);
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_PHONE :// "targetCallPhone"; //被叫；由拨号时发送过来
                        callHistory.setTargetCallPhone(value);
                        break;
                    case RedisFields.CALL_HISTORY_SHOW_NUM :// "showNum"; //主显号码：小号、E1固话等；由拨号时发送过来
                        callHistory.setShowNum(value);
                        break;
                    case RedisFields.CALL_HISTORY_IMS :// "ims";
                        callHistory.setIms(value);
                        break;
                    case RedisFields.CALL_HISTORY_DATA_ID :// "dataId"; //置业或app数据库 数据id，用于jms推送数据时，置业或app更新数据的索引；这要求置业或app保存数据成功后再提交呼叫任务到云呼
                        callHistory.setDataId(Long.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_WHERE_FROM :// "whereFrom"; //来源：app,置业
                        callHistory.setWhereFrom(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_PAGE_FROM :// "pageFrom"; //app盘源,app联动call,置业盘源，置业联动call? （websocket）
                        callHistory.setPageFrom(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_MACHINE_FROM :// "machineFrom";//机器码：用于定位websocket对象（websocket）
                        callHistory.setMachineFrom(value);
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_TYPE :// "mainCallType"; //谁呼出？：经纪人/客户
                        callHistory.setMainCallType(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_CUSTOMER_NAME :// "customerName"; //客户名称
                        callHistory.setCustomerName(value);
                        break;
                    case RedisFields.CALL_HISTORY_PROJECT :// "project"; //项目名
                        callHistory.setProject(value);
                        break;
                    case RedisFields.CALL_HISTORY_PROPERTY_NO :
                        callHistory.setPropertyNo(value);
                        break;
                    case RedisFields.CALL_HISTORY_OBJECT_ID :
                        callHistory.setObjectId(value);
                        break;
                    case RedisFields.CALL_HISTORY_COMMIT_TO :// "commitTo"; //提交到哪里：东进/电信
                        callHistory.setCommitTo(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_COMMIT_OK :// "commitOk"; //提交呼叫任务到CTI/福建电信 成功
                        callHistory.setCommitOk(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_COMMIT_TIME :// "提交时间
                        callHistory.setCommitTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;

                    case RedisFields.CALL_HISTORY_CITY:
                        callHistory.setCity(Integer.valueOf(value));    // "city"; //经纪所在的城市
                        break;
                    case RedisFields.CALL_HISTORY_SESSION_ID :// "sessionId"; //会话ID
                        callHistory.setSessionId(value);
                        break;
                    case RedisFields.CALL_HISTORY_CALL_TYPE :// "callType"; //通话类型：呼出、呼入
                        callHistory.setCallType(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_RECORD_FILE_URL :// "recordFileUrl"; //录音文件地址
                        callHistory.setRecordFileUrl(value);
                        break;
                    case RedisFields.CALL_HISTORY_RECORD_TIME_LENTH :// "recordTimeLength"; //录音时长（S）
                        callHistory.setRecordTimeLength(Long.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_RECORD_FILE_URL_PART_A:   //recordFileUrl //语音分析录音文件地址
                        callHistory.setRecordFileUrlPartA(value);
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_TYPE:           // voiceType     //语音分析结果
                        callHistory.setVoiceType(value);
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_CATEGORY:       // voiceCategory //语音分析结果分类
                        callHistory.setVoiceCategory(value);
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_CONTENT:        // voiceContent  //语音内容
                        callHistory.setVoiceContent(value);
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_STATUS:
                        callHistory.setVoiceStatus(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_ENGINE:
                        callHistory.setVoiceEngine(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_START_TIME:
                        callHistory.setVoiceStartTime(DateUtils.getDateFromString(value, DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_VOICE_END_TIME:
                        callHistory.setVoiceEndTime(DateUtils.getDateFromString(value, DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_RINGING :// "mainCallRinging"; //主叫响铃
                        callHistory.setMainCallRinging(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_RINGING_TIME :// "mainCallRingingTime"; //主叫响铃时间
                        callHistory.setMainCallRingingTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_MAIN_CALL_RINGING_TIME :// "receiveMainCallRingingTime"; //接收主叫响铃状态时间
                        callHistory.setReceiveMainCallRingingTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_ANSWERED :// "mainCallAnswered"; //主叫应答
                        callHistory.setMainCallAnswered(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_ANSWERED_TIME :// "mainCallAnsweredTime"; //主叫应答
                        callHistory.setMainCallAnsweredTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_HISTORY_MAIN_CALL_ANSWERED_TIME :// "receiveMainCallAnsweredTime"; //接收主叫应答状态时间
                        callHistory.setReceiveMainCallAnsweredTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;

                    case RedisFields.CALL_HISTORY_MAIN_CALL_FAILED :// "mainCallFailed"; //呼叫主叫失败：如果没有响铃，表示主叫空号；如有响铃，表示未接听或把来电号码加入黑名单或手机飞行模式（电信）
                        callHistory.setMainCallFailed(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_MAIN_CALL_FAILED_TIME :// "mainCallFailedTime"; //呼叫主叫失败时间
                        callHistory.setMainCallFailedTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_MAIN_CALL_FAILED_TIME :// "receiveMainCallFailedTime"; //接收呼叫主叫失败状态时间
                        callHistory.setReceiveMainCallFailedTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_RINGING :// "targetCallRinging"; //被叫响铃
                        callHistory.setTargetCallRinging(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_RINGING_TIME :// "targetCallRingingTime"; //被叫响铃时间
                        callHistory.setTargetCallRingingTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_RINGING_TIME :// "receiveTargetCallRingingTime"; //接收被叫响铃状态时间
                        callHistory.setReceiveTargetCallRingingTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;

                    case RedisFields.CALL_HISTORY_TARGET_CALL_ANSWERED :// "targetCallAnswered"; //被叫应答
                        callHistory.setTargetCallAnswered(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_ANSWERED_TIME :// "targetCallAnsweredTime"; //被叫应答
                        callHistory.setTargetCallAnsweredTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_ANSWERED_TIME :// "receiveTargetCallAnsweredTime"; //接收被叫应答状态时间
                        callHistory.setReceiveTargetCallAnsweredTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_FAILED :// "targetCallFailed"; //呼叫被叫失败：如果没有响铃，表示被叫空号；如有响铃，表示未接听或把来电号码加入黑名单或手机飞行模式；（电信）
                        callHistory.setTargetCallFailed(Boolean.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_TARGET_CALL_FAILED_TIME :// "targetCallFailedTime"; //呼叫被叫失败时间
                        callHistory.setTargetCallFailedTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_FAILED_TIME :// "receiveTargetCallFailedTime"; //接收呼叫被叫失败状态时间
                        callHistory.setReceiveTargetCallFailedTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_DISCONNECT_TIME :// "disconnectTime"; //通话结束时间:有此时间表明是正常通话，记录第一次返回disconnect状态的时间
                        callHistory.setDisconnectTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_DISCONNECT_TIME :// "receiveDisconnectTime"; //接受通话结束状态时间
                        callHistory.setReceiveDisconnectTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_APP_START_TIME :// "receiveAppStartTime"; //接受APP开始通话时间
                        callHistory.setReceiveAppStartTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_APP_STOP_TIME :// "receiveAppStopTime"; //接受通话结束状态时间
                        callHistory.setReceiveAppStopTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.RECEIVE_CALL_HISTORY_APP_RECORD_FILE_TIME :// "receiveAppRecordFileTime"; //接受app上传文件时间束状态时间
                        callHistory.setReceiveApprecordFileTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.CALL_HISTORY_MESSAGE_ID :// "messageId"; //jms msg Id
                        callHistory.setMessageId(value);
                        break;
                    case RedisFields.CALL_HISTORY_REMARK :
                        callHistory.setRemark(value);
                        break;
                    case RedisFields.CALL_HISTORY_FAILED_REASON :
                        callHistory.setFailedReason(value);
                        break;
                    case RedisFields.CALL_HISTORY_POINTS :
                        callHistory.setPoints(Integer.valueOf(value));
                        break;
                    case RedisFields.CALL_HISTORY_MONEY :
                        callHistory.setMoney(Float.valueOf(value));
                        break;
                    case RedisFields.INTERRUPT :
                        callHistory.setInterrupt(Integer.valueOf(value));
                        break;
                    case RedisFields.INTERRUPTTIME :
                        callHistory.setInterruptTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.PUBLIC_PUSH_INSERT_QUEUE:
                        callHistory.setIsInserted(Boolean.valueOf(value));
                        break;
                    case RedisFields.MAIN_CALL_START_TIME :
                        callHistory.setMainCallStartTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.MAIN_CALL_END_TIME :
                        callHistory.setMainCallEndTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.MAIN_CALL_LENGTH :
                        callHistory.setMainCallLength(Integer.valueOf(value));
                        break;
                    case RedisFields.TARGET_CALL_START_TIME:
                        callHistory.setTargetCallStartTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.TARGET_CALL_END_TIME :
                        callHistory.setTargetCallEndTime(DateUtils.getDateFromString(value,DateUtils.DATE_FORMAT_DATETIME_SSS));
                        break;
                    case RedisFields.TARGET_CALL_LENGTH :
                        callHistory.setTargetCallLength(Integer.valueOf(value));
                        break;

                }
            }

            */
/*计算通话时长（ms）*//*

            if((callHistory.getCommitTo() == 0 || callHistory.getCallType() == 1)
                    && (callHistory.getTargetCallAnsweredTime()!=null) && (callHistory.getDisconnectTime()!=null)){
                long connectedLength = (callHistory.getDisconnectTime().getTime() - callHistory.getTargetCallAnsweredTime().getTime()) / 1000;
                callHistory.setRecordTimeLength(connectedLength > 0 ? connectedLength : 0);
            }

        } catch (Exception e) {
            e.printStackTrace();
            for(String b:callHistoryMap.keySet()){
                System.out.println("new callHistory failed from RedisHashMap--> key:"+ b+" value:"+callHistoryMap.get(b));
            }
        }finally {
            return callHistory;
        }

    }

    public static Map<String,String> turnToPushMap(CallHistory callHistory) {

        Map<String, String> map = new HashMap<>(20);

        if(callHistory == null)
            return map;

        map.put(RedisFields.CREATE_TIME, DateUtils.formatDate(callHistory.getCreateTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.CREATE_USER_ID, callHistory.getCreateUserId().toString());
        map.put(RedisFields.CALL_HISTORY_SESSION_ID, callHistory.getSessionId());
        map.put(RedisFields.CALL_HISTORY_MAIN_CALL_PHONE, callHistory.getMainCallPhone().toString());
        map.put(RedisFields.CALL_HISTORY_TARGET_CALL_PHONE, callHistory.getTargetCallPhone().toString());

        map.put(RedisFields.CALL_HISTORY_DATA_ID, callHistory.getDataId().toString());
        map.put(RedisFields.CALL_HISTORY_WHERE_FROM, callHistory.getWhereFrom().toString());
        map.put(RedisFields.CALL_HISTORY_PAGE_FROM, callHistory.getPageFrom().toString());
        map.put(RedisFields.CALL_HISTORY_CUSTOMER_NAME, callHistory.getCustomerName());
        map.put(RedisFields.CALL_HISTORY_MAIN_CALL_TYPE, callHistory.getMainCallType().toString());
        map.put(RedisFields.CALL_HISTORY_COMMIT_TO, callHistory.getCommitTo().toString());

        if (!StringUtil.isEmpty(callHistory.getObjectId()))
            map.put(RedisFields.CALL_HISTORY_OBJECT_ID, callHistory.getObjectId());

        map.put(RedisFields.CALL_HISTORY_CITY, callHistory.getCity().toString());
        map.put(RedisFields.CALL_HISTORY_CALL_TYPE, callHistory.getCallType().toString());


        switch (callHistory.getCommitTo()) {
            case 0:
            case 9:
                map.put(RedisFields.CALL_HISTORY_RECORD_FILE_URL, callHistory.getRecordFileUrl().toString());
                map.put(RedisFields.CALL_HISTORY_RECORD_TIME_LENTH, callHistory.getRecordTimeLength().toString());
                break;
            case 2:
            case 3:

                map.put(RedisFields.CALL_HISTORY_RECORD_FILE_URL, callHistory.getRecordFileUrl().toString());
                if (callHistory.getTargetCallAnswered() != null && true == callHistory.getTargetCallAnswered())
                    map.put(RedisFields.CALL_HISTORY_RECORD_TIME_LENTH, callHistory.getRecordTimeLength().toString());
                else
                    map.put(RedisFields.CALL_HISTORY_RECORD_TIME_LENTH, "0");
                break;
        }

        map.put(RedisFields.RECEIVE_CALL_HISTORY_MAIN_CALL_RINGING_TIME, DateUtils.formatDate(callHistory.getMainCallRingingTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.RECEIVE_HISTORY_MAIN_CALL_ANSWERED_TIME, DateUtils.formatDate(callHistory.getReceiveMainCallAnsweredTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.RECEIVE_CALL_HISTORY_MAIN_CALL_FAILED_TIME, DateUtils.formatDate(callHistory.getReceiveMainCallFailedTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));

        map.put(RedisFields.RECEIVE_CALL_HISTORY_DISCONNECT_TIME, DateUtils.formatDate(callHistory.getReceiveDisconnectTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.CALL_HISTORY_DISCONNECT_TIME, DateUtils.formatDate(callHistory.getDisconnectTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));

        map.put(RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_RINGING_TIME, DateUtils.formatDate(callHistory.getReceiveTargetCallRingingTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_ANSWERED_TIME, DateUtils.formatDate(callHistory.getReceiveTargetCallAnsweredTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));
        map.put(RedisFields.RECEIVE_CALL_HISTORY_TARGET_CALL_FAILED_TIME, DateUtils.formatDate(callHistory.getReceiveTargetCallFailedTime(), DateUtils.DATE_FORMAT_DATETIME_SSS));

        return map;
    }
}
*/
